import RPi.GPIO as GPIO
## setup
class Servo:
    # 舵机动作号标注 
    #   0~6 左旋
    #   7~13右旋
    def __init__(self,PIN_ID,HZ):
        self.PIN_ID = PIN
        GPIO.setup(self.PIN_ID, GPIO.OUT) # 建立输出通道
        self.HZ = HZ
        self.PWM = GPIO.PWM(self.PIN_ID, HZ_Servo)  # 将PWM波设置到输出通道
        self.PWM.start(0)
        self.PWM.ChangeDutyCycle(0)

    def Servo_action(self,action):
        self.PWM.ChangeDutyCycle((action - 6) % 13)

    def Servo_destroy(self):
        self.PWM.stop()
